Page({
  data: {
    array:[],  //画稿
    tabIndex: 1, //tab标签标示 1风景 2人文 3美食 4地图  5物产
   
  },
 
  onLoad(query){
    if(query.type){
      this.setData({
      tabIndex:query.type
    })
    }
  },
  onShow(){
    this.getList(this.data.tabIndex);

  },
  //前往明细查看
  onTap(ev){
     my.navigateTo({
      url: '/pages/draw/draw?drawId='+ev.currentTarget.dataset.id
    })
  },

  /**
   * 标签切换
   */
  tabChange(e) {
   
    this.setData({
      tabIndex:e.currentTarget.dataset.id
    })
    this.getList(e.currentTarget.dataset.id);
  },
  //请求后台接口
  getList(id){

     let that = this;
      my.showLoading({
        content: '加载中...'
      });
        //请求数据
      my.request({
      url: 'https://tiyi.site/seaHorse/app/draw/drawListByType/'+id,
      method: 'GET',
      data: {},
      dataType: 'json',
      success: function(res) {
        that.setData({
          array:res.data.list,
        })
      },
      fail: function(res) {
        my.alert({content: res});
      },
      complete: function(res) {
        my.hideLoading();
      }
      });
  }
  
});